package com.mi.abstractfactory;

public class Test {

	public static void main(String[] args) {
		//客户买车
		
		//1，创建客户对象
		Customer customer = new Customer();
		//2，创建4s店对象
		SSSS ssss = new SSSS();
		//3，创建一个汽车工厂对象
		AbstractCarFactory carFactory = new BenzCarFactory();
		//4，将创建一个汽车工厂对象设置到4s店，4s店和特定的汽车工厂产生了关联
		ssss.setCarFactory(carFactory);
		//5，客户买车，将ssss对象传入
		customer.buyCar(ssss);
		//6，客户开车
		customer.drive();
		
		
		SSSS hondaSSSS = new SSSS();
		hondaSSSS.setCarFactory(new HondaCarFactory());
		
		hondaSSSS.setCarFactory(new FordCarFactory());
	}
}
